// 食物模型类
import { GRID_SIZE } from '../constants/gameConstants'

export class Food {
  constructor() {
    this.position = { x: 0, y: 0 }
    this.relocate()
  }

  relocate() {
    this.position = {
      x: Math.floor(Math.random() * GRID_SIZE),
      y: Math.floor(Math.random() * GRID_SIZE)
    }
  }

  getPosition() {
    return this.position
  }
}
